Characteristics, what's the inverse of (x*(x+1))/2? [closed]

Posted by Valmond on Game Development See other posts from Game Development or by Valmond
Published on 2012-10-26T13:15:47Z Indexed on 2012/10/26 17:21 UTC
Read the original article Hit count: 101

Filed under:
|

In my game you can spend points to upgrade characteristics. Each characteristic has a formula like:

A) out = in : for one point spent, one pont gained (you spend 1 point on Force so your force goes from 5 to 6)

B) out = last level (starting at 1) : so the first point spent earns you 1 point, the next point spent earns you an additional 2 and so on (+3,+4,+5...)

C) The inverse of B) : You need to spend 1 point to earn one, then you need to spend 2 to earn another one and so on.

I have already found the formula for calculating the actual level of B when points spent = x :

charac = (x*(x+1))/2

But I'd like to know what the "reverse" version of B) (usable for C) is, ie. if I have spent x points, how many have I earned if 1 spent gives 1, 1+2=3 gives 2, 1+2+3=6 gives 3 and so on.

I know I can just calculate the numbers but I'd like to have the formula because its neater and so that I can stick it in an excel sheet for example...

Thanks!

ps. I think I have nailed it down to something like charac = sqrt( x*m +k) but then I'm stuck doing number guessing for k and m and I feel I might be wrong anyway as I get close but never hits the spot.

© Game Development or respective owner

Related posts about game-design

Related posts about math